#ifndef ERRORLABEL_H
#define ERRORLABEL_H
#include <QLabel>

class ErrorLabel : public QLabel
{
  Q_OBJECT
public:
  explicit ErrorLabel(const QString& file, const QString& mess, int line,
                      QWidget* parent = 0) : QLabel(parent) {
    this->setText(file + " : " + QString::number(line) + " :\n" + mess);
    this->filepath = file;
    this->line = line;
    setStyleSheet("QLabel{background-color:red;border-radius:3px;"
                  "border-width:2px}QLabel:hover{background-color:orangered;}");
  }
protected:
  void mouseDoubleClickEvent(QMouseEvent *e) {
    emit clicked(filepath, line);
    QLabel::mouseDoubleClickEvent(e);
  }

private:
  QString filepath;
  int line;

signals:
  void clicked(QString, int);
};
#endif // ERRORLABEL_H
